package com.beyondsoft.common.core.sys.initialization;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 队列配置
 */
@Configuration
public class FanoutRabbitConfig {

    public final static String FANOUT_QUEUE = "fanout.TEST";

    @Bean
    public Queue testMessage() {
        return new Queue(FanoutRabbitConfig.FANOUT_QUEUE);
    }

    @Bean
    public Queue usersMessage() {
        return new Queue(FanoutRabbitConfig.FANOUT_QUEUE);
    }

    @Bean
    FanoutExchange fanoutExchange() {
        return new FanoutExchange("fanoutExchange");
    }


    @Bean
    Binding bindingExchangeA(Queue testMessage, FanoutExchange fanoutExchange) {
        return BindingBuilder.bind(testMessage).to(fanoutExchange);
    }

}
